
import {INCREMENT,DECREMENT} from '../constant';
import store from '../store';

//返回的是对象，则是同步action,action 默认支持普通对象 plain object
export const increment=data=>({type:INCREMENT,data:data})
export const decrement=data=>({type:DECREMENT,data:data})
//返回是函数，则是异步action
export const incrementAsync=(data,time)=>{
    return ()=>{
        console.log(data,time)
        setTimeout(() => {
            store.dispatch(increment(data))
        }, time);
    }
} 